//
//  ISDUETHoangDaoDetailViewController.m
//  12Cung
//
//  Created by Tran Bao Thai on 8/5/12.
//  Copyright (c) 2012 Tran Bao Thai. All rights reserved.
//

#import "ISDUETHoangDaoDetailViewController.h"
#import "Constants.h"

@interface ISDUETHoangDaoDetailViewController ()

@end

@implementation ISDUETHoangDaoDetailViewController
@synthesize detailDict;
@synthesize lblTitle;
@synthesize contentWebView;
@synthesize lblSlogan;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationController.navigationBarHidden = YES;
    [lblTitle setText:[detailDict objectForKey:KEY_NAME]];
    [lblSlogan setText:[detailDict objectForKey:KEY_SLOGAN]];

    NSString * html = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]pathForResource:[detailDict objectForKey:KEY_FILE] ofType:@"html"] encoding:NSUTF8StringEncoding error:nil];
    NSString *path = [[NSBundle mainBundle] bundlePath];
    NSURL *baseURL = [NSURL fileURLWithPath:path];
    [contentWebView loadHTMLString:html baseURL:baseURL];
}

- (void)viewDidUnload
{
    [self setContentWebView:nil];
    [self setLblTitle:nil];
    [self setLblSlogan:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc {
    [detailDict release];
    [contentWebView release];
    [lblTitle release];
    [lblSlogan release];
    [super dealloc];
}

- (IBAction)backAction:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
